package com.xmotor.test_annotation_StrategyModel.controller;

import com.xmotor.test_annotation_StrategyModel.pojo.Order;
import com.xmotor.test_annotation_StrategyModel.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Author Dang Xianyue
 * @Date 2020-10-05 16:44
 * @Version 1.0
 */
@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    // localhost:8090/order/test2?source=&payMethod=
    // localhost:8090/order/test2?source=mobile&payMethod=
    // localhost:8090/order/test2?source=pc&payMethod=
    // localhost:8090/order/test2?source=mobile&payMethod=AliPay
    // localhost:8090/order/test2?source=mobile&payMethod=WeChat
    // localhost:8090/order/test2?source=pc&payMethod=AliPay
    // localhost:8090/order/test2?source=pc&payMethod=WeChat
    @RequestMapping("order/test2")
    public Object test2(@RequestParam("source")String source,
                        @RequestParam("payMethod")String payMethod) throws Exception{
        Order order = new Order();
        order.setSource(source);
        order.setPayMethod(payMethod);
        return orderService.orderService(order);
    }
}
